package ConditionPackage;

import java.math.BigDecimal;

import SquarePackage.Square;
import SquarePackage.Temperature;

public class HumidityTemperatureCondition implements Condition {
	/**
	 * default constructor for maxtemperature Zero en minTemperature 50
	 */ 
	public HumidityTemperatureCondition(){
		this(new Temperature(0),new BigDecimal("50.00"));
	}
	/**
	 * constructor to set your own values for Temperature and Humidity
	 * @param Temperature the mintemp to set
	 * @param humiditypercent the minhumidity to set
	 */
	public HumidityTemperatureCondition(Temperature Temperature, BigDecimal humiditypercent){
		setHumidity(humiditypercent);
		setTemperature(Temperature);
		setValue(-1);
		setValue2(1);
		
	}
	/**
	 * gets the fact if we are checking equals larger or smaller
	 * @return 1=larger 0=equals -1= smaller
	 */
	public int getValue() {
		return value;
	}
	/**
	 * sets the condition:
	 * -1= < 
	 * 0 = equals
	 * 1 = >
	 * @param value
	 */
	public void setValue(int value) {
		this.value = value;
	}
	/**
	 * idem setValue
	 * @param value2
	 */
	public void setValue2(int value2) {
		this.value2 = value2;
	}
	private Temperature temperature;
	private BigDecimal humidity;
	private int value;
	private int value2;
	/**
	 * checker
	 * @return True if both conditions Are true, meaning that both the Temperature and Humidity comparators values check out
	 */
	@Override
	public boolean checkCondition(Square object) {
		if(object.getHumidity().compareTo(humidity)==value2 && object.getTemperature().compareTo(temperature) == value)
			return true;
		else
			return false;
	}
	/**
	 * sets the temperature to compare with
	 * @param Temperature
	 */
	public void setTemperature(Temperature Temperature){
		temperature= Temperature;
	}
	/**
	 * sets the humidity to compare with
	 * @param Humidity
	 */
	public void setHumidity(BigDecimal Humidity){
		humidity = Humidity;
	}
	
}
